(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    ["pages/main/sales/adddriver"], {
        "20bc": function (e, t, n) {
            "use strict";
            n.r(t);
            var i = n("e207"),
                r = n("d175");
            for (var o in r)["default"].indexOf(o) < 0 && function (e) {
                n.d(t, e, (function () {
                    return r[e]
                }))
            }(o);
            n("664e");
            var a = n("f0c5"),
                l = Object(a["a"])(r["default"], i["b"], i["c"], !1, null, "41255082", null, !1, i["a"], void 0);
            t["default"] = l.exports
        },
        "5e78": function (e, t, n) {},
        "664e": function (e, t, n) {
            "use strict";
            var i = n("5e78"),
                r = n.n(i);
            r.a
        },
        "67ac": function (e, t, n) {
            "use strict";
            (function (e) {
                var i = n("4ea4");
                Object.defineProperty(t, "__esModule", {
                    value: !0
                }), t.default = void 0;
                var r = i(n("2eee")),
                    o = i(n("c973")),
                    a = {
                        data: function () {
                            return {
                                isClick: true, // 节流按钮
                                addState: false,
                                url: getApp().globalData.apiurl,
                                saleId: "",
                                model: {},
                                str: [],
                                opertime: "",
                                driverList: [],
                                rules: {
                                    drivername: {
                                        rules: [{
                                            required: !0,
                                            errorMessage: "司机姓名不能为空"
                                        }]
                                    },
                                    driverphone: {
                                        rules: [{
                                            required: !0,
                                            pattern: /^[1][3,4,5,7,8,9][0-9]{9}$/,
                                            errorMessage: "司机电话格式不正确"
                                        }]
                                    },
                                    licenseplate: {
                                        rules: [{
                                            required: !0,
                                            pattern: /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/,
                                            errorMessage: "请输入正确格式的车牌号码"
                                        }]
                                    }
                                }
                            }
                        },
                        methods: {
                            throttle() {
                                if (this.isClick) {
                                    this.isClick = false
                                    setTimeout(() => {
                                        this.isClick = true
                                    }, 1000);
                                } else {
                                    return;
                                }
                            },
                            setPhone: function () {
                                this.addState = true;

                            },
                            setLicenseplate: function () {
                                this.addState = false;
                            },
                            submitForm: function () {
                                var t = this,
                                    n = getApp().globalData.userinfo.nickName,
                                    i = this,
                                    r = this.driverList.length;
                                if (this.driverList.forEach((function (o) {
                                        o.orderid = i.saleId, e.request({
                                            url: t.url + "salesdocuments/salesdocuments",
                                            method: "PUT",
                                            data: {
                                                id: i.saleId,
                                                state: 0,
                                                maintainpeople: n
                                            }
                                        }), --r
                                    })), r <= 0) {
                                    var o = [];
                                    e.switchTab({
                                        url: "/pages/main/index"
                                    })
                                    this.goToPointout("添加成功!", 1);
                                    return;
                                    e.request({

                                        url: this.url + "appLoginRedis/getSaleUserList",
                                        method: "GET",
                                        data: {
                                            dictLabel: "审批角色权限字符"
                                        },
                                        success: function (e) {
                                            console.log(e)
                                            // console.log("查询得到权限字符：", e.data), e.data.forEach((function (e) {
                                            //     o.push(e.nickName)
                                            // }))
                                        },
                                        complete: function () {

                                            // getApp().globalData.appPushInfo("业务员提交审批", o, "销售单审批", "业务员提交了一条销售单，请及时审批！", "", getApp().globalData.getId()), e.switchTab({
                                            //     url: "/pages/main/index"
                                            // })
                                        }
                                    })
                                } else;
                            },
                            deleteItem: function (e) {
                                wx.request({
                                    url: this.url + "driverorders/driverorders/delByLicenseplate",
                                    method: "GET",
                                    data: {
                                        driverphone: this.driverList[e].driverphone,
                                        drivername: this.driverList[e].drivername,
                                        licenseplate: this.driverList[e].licenseplate
                                    },
                                    success: function (res) {
                                        console.log(res);
                                    }
                                })
                                this.driverList.splice(e, 1);
                                return;
                                this.driverList.splice(e, 1);
                                this.model.driverphone = "";
                                this.model.drivername = "";
                                this.model.licenseplate = "";
                            },
                            goToPointout: function (t, n) {
                                e.showToast({
                                    title: t,
                                    icon: n ? "success" : "error",
                                    duration: 2e3
                                })
                            },
                            testjieliu() {
                                console.log("截流操作")
                            },

                            adddriverFrom: function () {
                                this.throttle(); // 截流操作
                                console.log("添加司机")
                                let _this = this;
                                let reg = /^[1][3,4,5,6,7,8,9,][0-9]{9}$/;
                                const plateNumber = /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/;

                                // false:添加的车牌
                                // true:添加的电话
                                if (!_this.addState) {
                                    console.log(_this.model.licenseplate)
                                    console.log(_this.model.licenseplate.length)
                                    if (_this.model.licenseplate.length == 7 || _this.model.licenseplate.length == 8) {
                                        return this.pushDriverList("", _this.model.licenseplate);
                                    }
                                    return this.goToPointout("车牌号不正确!", !1);

                                    return;
                                    if (_this.model.licenseplate == null || _this.model.licenseplate == undefined || _this.model.licenseplate == NaN || _this.model.licenseplate == "") return this.goToPointout("请输入车牌号码", !1)
                                    if (!plateNumber.test(_this.model.licenseplate)) return this.goToPointout("车牌号不正确!", !1);
                                } else {
                                    console.log("添加手机号")
                                    console.log(_this.model.driverphone)
                                    if (_this.model.driverphone == null || _this.model.driverphone == undefined || _this.model.driverphone == NaN || _this.model.driverphone == "") return this.goToPointout("请输入手机号码", !1)

                                    if (!reg.test(_this.model.driverphone)) return this.goToPointout("格式不正确", !1);
                                    this.pushDriverList(_this.model.driverphone);
                                }


                                // if (_this.model.drivername == null || _this.model.drivername == undefined || _this.model.drivername == NaN || _this.model.drivername == "" ||
                                //     _this.model.driverphone == null || _this.model.driverphone == undefined || _this.model.driverphone == NaN || _this.model.driverphone == "" ||
                                //     _this.model.licenseplate == null || _this.model.licenseplate == undefined || _this.model.licenseplate == NaN || _this.model.licenseplate == ""
                                // ) return this.goToPointout("司机信息有误", !1)


                            },
                            pushDriverList: function (phone, licenseplate) {
                                console.log("追加方法")
                                let _this = this;
                                let fata = {
                                    licenseplate: licenseplate,
                                    driverphone: phone
                                };
                                // 没有车牌号的情况下
                                if (licenseplate == null || licenseplate == undefined) {
                                    // 生成车牌号码 长度七位
                                    wx.request({
                                        url: _this.url + 'driverorders/driverorders/queryLicensePlate',
                                        success: res => {
                                            // 赋值得到添加的车牌号码
                                            fata.licenseplate = res.data;
                                            wx.request({
                                                url: _this.url + "driverorders/driverorders/listByLicenseplate",
                                                method: "GET",
                                                data: {
                                                    licenseplate: fata.licenseplate == "" ? licenseplate : fata.licenseplate
                                                },
                                                success: (res) => {
                                                    if (res.data.total != 0) return _this.goToPointout("司机已有订单！")
                                                    _this.driverList.push({ // 追加司机list
                                                        drivername: "恒泰司机",
                                                        // driverphone: _this.model.driverphone==undefined?"无":_this.model.driverphone,
                                                        driverphone: fata.driverphone == undefined ? "无" : fata.driverphone,
                                                        licenseplate: fata.licenseplate == undefined ? "无" : fata.licenseplate,
                                                        ordertime: _this.opertime
                                                    });
                                                    // 添加司机请求函数
                                                    wx.request({
                                                        url: _this.url + "driverorders/driverorders",
                                                        method: "POST",
                                                        data: {
                                                            drivername: "恒泰司机",
                                                            driverphone: fata.driverphone,
                                                            licenseplate: fata.licenseplate,
                                                            ordertime: _this.opertime,
                                                            orderid: _this.saleId,
                                                            createname: getApp().globalData.userinfo.nickName
                                                        },
                                                        complete: () => {},
                                                    });

                                                    // var i = _this.driverList.length;
                                                    // _this.driverList.forEach((item) => {
                                                    //     item.orderid = _this.saleId;
                                                    //     wx.request({
                                                    //         url: _this.url + "driverorders/driverorders",
                                                    //         method: "POST",
                                                    //         data: item,
                                                    //         complete: () => {},
                                                    //     });
                                                    //     --i;
                                                    // });
                                                    // 清空表单
                                                    _this.model.driverphone = '';
                                                    _this.model.drivername = '';
                                                    _this.model.licenseplate = '';
                                                },
                                                fail: () => {
                                                    _this.goToPointout("错误！", !1);
                                                },
                                            });
                                        }
                                    })
                                } else {
                                    wx.request({
                                        url: _this.url + "driverorders/driverorders/listByLicenseplate",
                                        method: "GET",
                                        data: {
                                            licenseplate: fata.licenseplate == "" ? licenseplate : fata.licenseplate
                                        },
                                        success: (res) => {
                                            if (res.data.total != 0) return _this.goToPointout("司机已有订单！")
                                            _this.driverList.push({ // 追加司机list
                                                drivername: "恒泰司机",
                                                // driverphone: _this.model.driverphone==undefined?"无":_this.model.driverphone,
                                                driverphone: fata.driverphone == undefined ? "无" : fata.driverphone,
                                                licenseplate: fata.licenseplate == undefined ? "无" : fata.licenseplate,
                                                ordertime: _this.opertime
                                            });
                                            wx.request({
                                                url: _this.url + "driverorders/driverorders",
                                                method: "POST",
                                                data: {
                                                    drivername: "恒泰司机",
                                                    orderid: _this.saleId,
                                                    driverphone: fata.driverphone,
                                                    licenseplate: fata.licenseplate,
                                                    ordertime: _this.opertime,
                                                    createname: getApp().globalData.userinfo.nickName
                                                },
                                                complete: () => {},
                                            });
                                            // var i = _this.driverList.length;
                                            // _this.driverList.forEach((item) => {
                                            //     item.orderid = _this.saleId;
                                            //     wx.request({
                                            //         url: _this.url + "driverorders/driverorders",
                                            //         method: "POST",
                                            //         data: item,
                                            //         complete: () => {},
                                            //     });
                                            //     --i;
                                            // });
                                            // 清空表单
                                            _this.model.driverphone = '';
                                            _this.model.drivername = '';
                                            _this.model.licenseplate = '';
                                        },
                                        fail: () => {
                                            _this.goToPointout("错误！", !1);
                                        },
                                    });
                                }

                            },
                            adddriver: function () {
                                var t = this,
                                    n = this;
                                return /^([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})$/.test(n.model.licenseplate) ? /^[1][3,4,5,6,7,8,9,][0-9]{9}$/.test(n.model.driverphone) ? null == n.model.drivername || void 0 == n.model.drivername || NaN == n.model.drivername || "" == n.model.drivername || null == n.model.driverphone || void 0 == n.model.driverphone || NaN == n.model.driverphone || "" == n.model.driverphone || null == n.model.licenseplate || void 0 == n.model.licenseplate || NaN == n.model.licenseplate || "" == n.model.licenseplate ? this.goToPointout("司机信息有误", !1) : void e.request({
                                    url: this.url + "driverorders/driverorders/listByLicenseplate",
                                    method: "GET",
                                    data: {
                                        licenseplate: n.model.licenseplate
                                    },
                                    success: function (i) {
                                        if (0 != i.data.total) return t.goToPointout("司机已有订单！");
                                        n.driverList.push({
                                            drivername: n.model.drivername,
                                            driverphone: n.model.driverphone,
                                            licenseplate: n.model.licenseplate,
                                            ordertime: n.opertime,
                                            createname: getApp().globalData.userinfo.nickName
                                        });
                                        t.driverList.length;
                                        t.driverList.forEach((function (i) {
                                            i.orderid = n.saleId, e.request({
                                                url: t.url + "driverorders/driverorders",
                                                method: "POST",
                                                data: i,
                                                complete: function () {}
                                            })
                                        })), n.model.driverphone = "", n.model.drivername = "", n.model.licenseplate = ""
                                    },
                                    fail: function () {
                                        t.goToPointout("错误！", !1)
                                    }
                                }) : this.goToPointout("手机号格式不正确", !1) : this.goToPointout("车牌号不正确!", !1)


                            },
                            initData: function (e) {
                                console.log('进入司机页面', e)
                                var t = this;
                                var o = e.split("@");
                                t.saleId = o[0];
                                t.opertime = o[1];

                                wx.request({
                                    url: t.url + 'driverorders/driverorders/list',
                                    method: "GET",
                                    data: {
                                        orderid: t.saleId
                                    },
                                    success: res => {
                                        // 赋值得到添加的车牌号码
                                        // fata.licenseplate = ;
                                        // console.log(res.data.rows)
                                        // console.log(res.data.rows[0].licenseplate);
                                        for (let index = 0; index < res.data.rows.length; index++) {
                                            t.driverList.push({
                                                drivername: res.data.rows[index].drivername,
                                                driverphone: res.data.rows[index].driverphone,
                                                licenseplate: res.data.rows[index].licenseplate,
                                                ordertime: t.opertime
                                            });

                                        }

                                    }
                                })
                                // return (0, o.default)(r.default.mark((function n() {
                                //     var i, o;
                                //     return r.default.wrap((function (n) {
                                //         while (1) switch (n.prev = n.next) {
                                //             case 0:
                                //                 i = t, 
                                //                 console.log("初始化订单id", e), 
                                //                 o = e.split("@"), 
                                //                 console.log(o), 
                                //                 i.saleId = o[0], 
                                //                 i.opertime = o[1];
                                //             case 6:
                                //             case "end":
                                //                 return n.stop()
                                //         }
                                //     }), n)
                                // })))()
                            }
                        },
                        onLoad: function (e) {
                            //console.log("来到司机页面")
                            this.driverList = [];
                            this.initData(e.id);
                        }
                    };
                t.default = a
            }).call(this, n("543d")["default"])
        },
        c2d9: function (e, t, n) {
            "use strict";
            (function (e, t) {
                var i = n("4ea4");
                n("c150"), n("5c17"), n("a9ff");
                i(n("66fd"));
                var r = i(n("20bc"));
                e.__webpack_require_UNI_MP_PLUGIN__ = n, t(r.default)
            }).call(this, n("bc2e")["default"], n("543d")["createPage"])
        },
        d175: function (e, t, n) {
            "use strict";
            n.r(t);
            var i = n("67ac"),
                r = n.n(i);
            for (var o in i)["default"].indexOf(o) < 0 && function (e) {
                n.d(t, e, (function () {
                    return i[e]
                }))
            }(o);
            t["default"] = r.a
        },
        e207: function (e, t, n) {
            "use strict";
            n.d(t, "b", (function () {
                return r
            })), n.d(t, "c", (function () {
                return o
            })), n.d(t, "a", (function () {
                return i
            }));
            var i = {
                    uniForms: function () {
                        return Promise.all([n.e("common/vendor"), n.e("components/uni-forms/uni-forms")]).then(n.bind(null, "0933"))
                    },
                    uniFormsItem: function () {
                        return n.e("components/uni-forms-item/uni-forms-item").then(n.bind(null, "4828"))
                    },
                    uniEasyinput: function () {
                        return Promise.all([n.e("common/vendor"), n.e("components/uni-easyinput/uni-easyinput")]).then(n.bind(null, "5dad"))
                    },
                    uniSwipeAction: function () {
                        return n.e("components/uni-swipe-action/uni-swipe-action").then(n.bind(null, "e7b4"))
                    },
                    uniSwipeActionItem: function () {
                        return Promise.all([n.e("common/vendor"), n.e("components/uni-swipe-action-item/uni-swipe-action-item")]).then(n.bind(null, "c498"))
                    }
                },
                r = function () {
                    var e = this.$createElement,
                        t = (this._self._c, null != this.driverList && this.driverList.length > 0);
                    this.$mp.data = Object.assign({}, {
                        $root: {
                            g0: t
                        }
                    })
                },
                o = []
        }
    },
    [
        ["c2d9", "common/runtime", "common/vendor"]
    ]
]);